package com.bookcloud.java21.chapter13.UI布局管理133;

import java.awt.*;
import javax.swing.*;

/** 布局管理133 */
public class LayoutDemo {
  public static void main(String[] args) {

    SwingUtilities.invokeLater(
        () -> {
          JFrame frame = new JFrame("布局管理133");
          frame.setSize(300, 200);
          frame.setVisible(true);
          // boder layout
          frame.setLayout(new BorderLayout());
          frame.add(new JButton("北"), BorderLayout.NORTH);
          frame.add(new JButton("西"), BorderLayout.WEST);
          frame.add(new JButton("中"), BorderLayout.CENTER);
          frame.add(new JButton("东"), BorderLayout.EAST);
          frame.add(new JButton("南"), BorderLayout.SOUTH);
          // 设置窗口的位置：居中
          frame.setLocationRelativeTo(null);
        });
  }
}
